|
1
|
|
|
import { Text } from './../../../assets/data/text.d'; |
|
2
|
|
|
import { NameInputComponent } from './../../fragments/name-input/name-input.component'; |
|
3
|
|
|
import { KeyboardService } from './../../data/keyboard.service'; |
|
4
|
|
|
/** |
|
5
|
|
|
Copyright 2018 June Hanabi |
|
6
|
|
|
|
|
7
|
|
|
Licensed under the Apache License, Version 2.0 (the "License"); |
|
8
|
|
|
you may not use this file except in compliance with the License. |
|
9
|
|
|
You may obtain a copy of the License at |
|
10
|
|
|
|
|
11
|
|
|
http://www.apache.org/licenses/LICENSE-2.0 |
|
12
|
|
|
|
|
13
|
|
|
Unless required by applicable law or agreed to in writing, software |
|
14
|
|
|
distributed under the License is distributed on an "AS IS" BASIS, |
|
15
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
16
|
|
|
See the License for the specific language governing permissions and |
|
17
|
|
|
limitations under the License. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
import { Component, NgZone, OnInit } from '@angular/core'; |
|
21
|
|
|
import { TextService } from '../../data/text.service'; |
|
22
|
|
|
|
|
23
|
|
|
@Component({ |
|
24
|
|
|
selector: 'app-keyboards', |
|
25
|
|
|
templateUrl: './keyboards.component.pug', |
|
26
|
|
|
styleUrls: ['./keyboards.component.scss'] |
|
27
|
|
|
}) |
|
28
|
|
|
export class KeyboardsComponent implements OnInit { |
|
29
|
|
|
constructor( |
|
30
|
|
|
public zone: NgZone, |
|
31
|
|
|
public ks: KeyboardService, |
|
32
|
|
|
public ts: TextService |
|
33
|
|
|
) { } |
|
34
|
|
|
|
|
35
|
|
|
ngOnInit() { |
|
36
|
|
|
this.ks.registerKeyboard(this); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public open(input: NameInputComponent) { |
|
40
|
|
|
this.opened = true; |
|
41
|
|
|
this.input = input; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public close() { |
|
45
|
|
|
this.opened = false; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public append(key: Text) { |
|
49
|
|
|
if (this.input !== null) |
|
50
|
|
|
this.input.value += key.eng; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public opened: boolean = false; |
|
54
|
|
|
public input: NameInputComponent | null = null; |
|
55
|
|
|
} |
|
56
|
|
|
|